<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('高效录入辅助工具')" />
</head>
<body class="gray-bg">
<div class="col-sm-12">
    <blockquote class="" style="font-size:14px;">
        <h2>高效录入辅助工具</h2>
    </blockquote>
    <hr>
</div>

     <div class="container-div">
        <div class="row">
                <div class="col-sm-4">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <a class="btn btn-info btn-rounded" href="buttons.html#">使用说明</a>
                            <div class="ibox-tools">
                                <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </div>
                        </div>
                        <div class="ibox-content ">
                            <li>1.为提升人员录入数据的效率，特此开发此辅助工具</li>
                            <li>2.开启新一批次的工作，请点击此按钮
                                <a class="btn btn-w-m btn-primary" onclick="initConfig()" shiro:hasPermission="system:mq:export">
                                    <i class="fa fa-paste"></i>初始化参数
                                </a>
                            </li>
                        </div>
                    </div>
                </div>


                <div class="col-sm-4">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>上传附件</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <li>如不清楚excel模板，可通过此链接
                                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:mq:export">
                                    <i class="fa fa-download"></i>下载excel模板
                                </a>
                            </li>
                            <br>
                            <li>1.点击上传附件按钮，上传Excel数据</li>
                            <br>
                            <li>2.提示上传成功后，点击开始工作按钮，则在5秒后开启辅助人工快速重新设置密码</li>
                            <br>
                            <li class="text-warning">3.待步骤2操作完成后，点击辅助录入按钮，进行辅助人工快速输入数据</li>
                            <h3 class="font-bold">具体操作</h3>
                            <center>
                                <button id="uploadData" onclick="$.table.importExcel()" class="btn btn-primary btn-success dim " type="button"><i class="fa fa-upload"></i></button>
                                <!--<button id="startNewPwd"  onclick="startNewPwd()" class="btn btn-primary dim " type="button"><i class="fa fa-check">开始工作</i></button>-->
                                <button id="startWriteReport"  onclick="startWriteReport()" class="btn btn-danger  dim " type="button"><i class="fa ">辅助录入</i></button>
                            </center>

                        </div>
                    </div>
                </div>

                <div class="col-sm-4">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5><a class="btn btn-danger btn-rounded" href="javascript:void();">异常处理信息</a></h5>
                            <div class="ibox-tools">
                                <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <a class="btn btn-warning" onclick="downloadWordData()" shiro:hasPermission="system:mq:export">
                                <i class="fa fa-download"></i>下载明细数据
                            </a>
                            <form id="formId">
                                <input type="hidden" id="showErrorInfo" name="show" value="" />
                            </form>
                            <div class="col-sm-12 select-table table-striped">
                                <table id="bootstrap-table" data-mobile-responsive="true"></table>
                            </div>
                            <p>
                                <li class="text-warning">仅展示处理失败数据</li>
                            </p>

                        </div>
                    </div>
                </div>

            </div>


        </div>
    </div>

    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = "";
        var removeFlag = "";
        var prefix = ctx + "system/auto";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importData",
                modalExportDes: "确定下载",
                modalName: "模板数据",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : '序号'
                },
                {
                    field : 'aremark',
                    title : '异常描述',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value);
                    }
                }/*,
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
            };
            $.table.init(options);
            $("#showErrorInfo").val("");
        });

        function startNewPwd(){
            $("#showErrorInfo").val("YES");
            var msg = "";
            $("#startNewPwd").attr('disabled',true);
            $.post(prefix+"/startnewpwd",{msg:msg},function(result){
                //$.modal.alertSuccess(result.msg);
            });
        }
        function startWriteReport(){
            $("#startWriteReport").attr('disabled',true);
            $("#showErrorInfo").val("YES");
            $.post(prefix+"/startreport",{msg:''},function(result){
                //$.modal.alertSuccess(result.msg);
            });
        }
        function initConfig() {
            //刷新 初始化参数
            window.location.href=window.location.href;
        }

        function downloadWordData() {
            $.modal.loading("正在导出数据，请稍后...");
            $.post(prefix +"/download",function(result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        }
        function detail(id) {
            var url = $.table._option.updateUrl.replace("{id}", id);
            $.modal.open("查看" + $.table._option.modalName, url+"?view=readonly");
        }
    </script>
</body>

<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>

</html>